package com.fr.base.core.antlr;

import com.fr.base.core.antlr.ASdebug.ASDebugStream;
import com.fr.base.core.antlr.ASdebug.IASDebugStream;
import com.fr.base.core.antlr.ASdebug.TokenOffsetInfo;
import com.fr.base.core.antlr.collections.impl.BitSet;

public class TokenStreamBasicFilter
  implements TokenStream, IASDebugStream
{
  protected BitSet discardMask;
  protected TokenStream input;

  public TokenStreamBasicFilter(TokenStream paramTokenStream)
  {
    this.input = paramTokenStream;
    this.discardMask = new BitSet();
  }

  public void discard(int paramInt)
  {
    this.discardMask.add(paramInt);
  }

  public void discard(BitSet paramBitSet)
  {
    this.discardMask = paramBitSet;
  }

  public Token nextToken()
    throws TokenStreamException
  {
    for (Token localToken = this.input.nextToken(); (localToken != null) && (this.discardMask.member(localToken.getType())); localToken = this.input.nextToken());
    return localToken;
  }

  public String getEntireText()
  {
    return ASDebugStream.getEntireText(this.input);
  }

  public TokenOffsetInfo getOffsetInfo(Token paramToken)
  {
    return ASDebugStream.getOffsetInfo(this.input, paramToken);
  }
}